import 'package:flutter/material.dart';
import 'package:mi_mang_flutter/res/dimens.dart';
import 'package:mi_mang_flutter/res/styles.dart';
import 'package:mi_mang_flutter/utils/image_utils.dart';
import 'package:mi_mang_flutter/utils/locale_util.dart';

class IntroducePage extends StatefulWidget {
  IntroducePage({Key? key}) : super(key: key);

  @override
  _IntroducePageState createState() => _IntroducePageState();
}

class _IntroducePageState extends State<IntroducePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(i18n(context).featuresIntroduction),
        centerTitle: true,
      ),
      body: _buildBody(),
    );
  }

  Widget _buildBody() {
    return Material(
      child: ListView(
        padding: EdgeInsets.all(Dimens.gapDp15),
        children: <Widget>[
          Text(i18n(context).introduce1),
          Gaps.vGap8,
          _buildContent1(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce2),
          Gaps.vGap8,
          _buildContent2(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce3),
          Gaps.vGap8,
          _buildContent3(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce4),
          Gaps.vGap8,
          _buildContent4(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce5),
          Gaps.vGap8,
          _buildContent5(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce6),
          Gaps.vGap8,
          _buildContent6(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce7),
          Gaps.vGap8,
          _buildContent7(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce8),
          Gaps.vGap8,
          _buildContent8(),
          Gaps.vGap15,
          Divider(indent: 0.0),
          Gaps.vGap15,
          Text(i18n(context).introduce9),
          Gaps.vGap8,
          _buildContent9(),
          Gaps.vGap15,
        ],
      ),
    );
  }

  /// 每日一句
  Widget _buildContent1() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_0",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_1",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 分享
  Widget _buildContent2() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_2",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_3",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_4",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 下载壁纸
  Widget _buildContent3() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_5",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 语言
  Widget _buildContent4() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_6",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_7",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 字体
  Widget _buildContent5() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_6",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_8",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 字体大小
  Widget _buildContent6() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_6",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_9",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 登录
  Widget _buildContent7() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_10",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 收藏
  Widget _buildContent8() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_11",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
        loadImage(
          "introduce/introduce_12",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }

  /// 意见反馈
  Widget _buildContent9() {
    return Wrap(
      spacing: Dimens.gapDp15,
      runSpacing: Dimens.gapDp15,
      children: <Widget>[
        loadImage(
          "introduce/introduce_13",
          format: "jpg",
          width: Dimens.widthFactor(0.4),
        ),
      ],
    );
  }
}
